home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club (Business) 1997 July / Software of the Month Club - Business (Volume 239) (July 1997).iso / pc / code / c.dxr / 00008_Env C Logic 2.ls < prev    next >
Encoding:
Text File  |  1996-02-15  |  8.6 KB  |  260 lines

  1. global gWorld, gStates, gObjects, gCurKeyList, void, gCursorlist, sQTCharSprite, gHaveNavs, gTempHotRects, gHotRects
  2.  
  3. on doResolutionC08Down
  4.   increment(#thermDisplay, #down, 1)
  5.   set thisState to the result
  6.   increment(#vial, #down, 1)
  7.   CursorandUpdate()
  8.   score(#ThermometerOBJ, thisState)
  9. end
  10.  
  11. on doResolutionC08Up
  12.   increment(#thermDisplay, #UP, 1)
  13.   set thisState to the result
  14.   increment(#vial, #UP, 1)
  15.   CursorandUpdate()
  16.   score(#ThermometerOBJ, thisState)
  17. end
  18.  
  19. on DowindSpeedLeft
  20.   increment(#windSpeedDisplay, #down)
  21.   set thisState to the result
  22.   set the State of the windSpeedgraph of gObjects to getAt(the animList of getaProp(gObjects, #windSpeedgraph), thisState)
  23.   displayObj(getAt(the animList of getaProp(gObjects, #windSpeedgraph), thisState))
  24.   CursorandUpdate()
  25.   score(#windspeedObj, thisState)
  26. end
  27.  
  28. on DowindSpeedRight
  29.   increment(#windSpeedDisplay, #UP)
  30.   set thisState to the result
  31.   set the State of the windSpeedgraph of gObjects to getAt(the animList of getaProp(gObjects, #windSpeedgraph), thisState)
  32.   displayObj(getAt(the animList of getaProp(gObjects, #windSpeedgraph), thisState))
  33.   CursorandUpdate()
  34.   score(#windspeedObj, thisState)
  35. end
  36.  
  37. on DoEastWestLeft
  38.   incrementParent(#eastWestDisplay, #down, 1)
  39.   set thisState to the result
  40.   set the State of the eastWestMonitor of gObjects to getAt(the animList of getaProp(gObjects, #eastWestMonitor), thisState)
  41.   displayObj(getAt(the animList of getaProp(gObjects, #eastWestMonitor), thisState))
  42.   CursorandUpdate()
  43.   score(#EastWestTempObj, thisState)
  44. end
  45.  
  46. on DoeastWestRight
  47.   incrementParent(#eastWestDisplay, #UP, 1)
  48.   set thisState to the result
  49.   set the State of the eastWestMonitor of gObjects to getAt(the animList of getaProp(gObjects, #eastWestMonitor), thisState)
  50.   displayObj(getAt(the animList of getaProp(gObjects, #eastWestMonitor), thisState))
  51.   CursorandUpdate()
  52.   score(#EastWestTempObj, thisState)
  53. end
  54.  
  55. on score OBJref, ObjState
  56.   set puzzleAnswers to [#ThermometerOBJ: 7, #windspeedObj: 3, #EastWestTempObj: 2, #weatherObj: #icy]
  57.   if OBJref = #weatherObj then
  58.     if getaProp(getaProp(gStates, #BeenThere), #d01) then
  59.       setaProp(puzzleAnswers, #weatherObj, #hot)
  60.     end if
  61.     setaProp(getaProp(gStates, #Conditions), #Weather, ObjState)
  62.   end if
  63.   if ObjState = getaProp(puzzleAnswers, OBJref) then
  64.     set SolvedValue to 1
  65.   else
  66.     set SolvedValue to 0
  67.   end if
  68.   MakeDynamic(OBJref, #solved, SolvedValue)
  69.   return SolvedValue
  70. end
  71.  
  72. on incrementParent OBJref, direction, dontUpdate
  73.   set OBj to getaProp(gObjects, OBJref)
  74.   set myParentRef to getaProp(OBj, #Parent)
  75.   set myParent to getaProp(gObjects, myParentRef)
  76.   set howmany to count(the allStates of myParent)
  77.   set thisState to getOne(the allStates of myParent, the currentState of myParent)
  78.   if direction = #UP then
  79.     if thisState <> howmany then
  80.       set thisState to thisState + 1
  81.     else
  82.       set thisState to 1
  83.     end if
  84.   else
  85.     if direction = #down then
  86.       if thisState <> 1 then
  87.         set thisState to thisState - 1
  88.       else
  89.         set thisState to howmany
  90.       end if
  91.     end if
  92.   end if
  93.   if getaProp(OBj, #type) = #animatorParent then
  94.     displayObj(getAt(the animList of OBj, thisState))
  95.     MakeDynamic(OBJref, #currentState, getAt(getaProp(OBj, #animList), thisState))
  96.   else
  97.     set the castNum of sprite the SpriteNum of OBj to getAt(getAt(getaProp(OBj, #cast), thisState), 1)
  98.     if voidp(dontUpdate) then
  99.       CursorandUpdate()
  100.     end if
  101.     MakeDynamic(myParentRef, #currentState, getAt(getaProp(myParent, #allStates), thisState))
  102.     MakeDynamic(OBJref, #DisplayState, getaProp(myParent, #currentState))
  103.     MakeDynamic(OBJref, #State, getAt(getaProp(OBj, #allStates), thisState))
  104.   end if
  105.   return thisState
  106. end
  107.  
  108. on increment OBJref, direction, dontUpdate
  109.   set OBj to getaProp(gObjects, OBJref)
  110.   set howmany to count(the allStates of OBj)
  111.   set thisState to getOne(the allStates of OBj, the State of OBj)
  112.   if direction = #UP then
  113.     if thisState <> howmany then
  114.       set thisState to thisState + 1
  115.     else
  116.       set thisState to 1
  117.     end if
  118.   else
  119.     if direction = #down then
  120.       if thisState <> 1 then
  121.         set thisState to thisState - 1
  122.       else
  123.         set thisState to howmany
  124.       end if
  125.     end if
  126.   end if
  127.   set the castNum of sprite the SpriteNum of OBj to getAt(getAt(getaProp(OBj, #cast), thisState), 1)
  128.   if voidp(dontUpdate) then
  129.     CursorandUpdate()
  130.   end if
  131.   MakeDynamic(OBJref, #State, getAt(getaProp(OBj, #allStates), thisState))
  132.   MakeDynamic(OBJref, #DisplayState, getaProp(OBj, #State))
  133.   return thisState
  134. end
  135.  
  136. on DoReset
  137.   switchOFFC11()
  138. end
  139.  
  140. on DowindSpeedEnable
  141.   switchOnC11(#WindSpeedGraphObj)
  142. end
  143.  
  144. on DoTempRocketEnable
  145.   switchOnC11(#Rocketc08GraphObj)
  146. end
  147.  
  148. on DoEastWestBalloonEnable
  149.   switchOnC11(#EastWestBalloonGrafObj)
  150. end
  151.  
  152. on switchOFFC11
  153.   ChangeSpecialState(#weatherObj, #off)
  154.   MakeDynamic(#C11AccessControlPanel, #State, #menu)
  155.   MakeDynamic(#C11AccessControlPanel, #DisplayState, #menu)
  156.   MakeDynamic(#WindSpeedGraphObj, #loc, getaProp(getaProp(gObjects, #WindSpeedGraphObj), #offloc))
  157.   MakeDynamic(#EastWestBalloonGrafObj, #loc, getaProp(getaProp(gObjects, #EastWestBalloonGrafObj), #offloc))
  158.   MakeDynamic(#Rocketc08GraphObj, #loc, getaProp(getaProp(gObjects, #Rocketc08GraphObj), #offloc))
  159.   MakeDynamic(#barGraphBkgnd, #DisplayState, #false)
  160.   cleanUpmySeasonsAnim()
  161.   MakeDynamic(#AttrAnim, #paused, 0)
  162. end
  163.  
  164. on switchOnC11 whichChild
  165.   set ParentObjRef to #weatherObj
  166.   set ParentOBJ to getaProp(gObjects, ParentObjRef)
  167.   set OBj to getaProp(gObjects, whichChild)
  168.   set myCousin to getaProp(OBj, #cousin)
  169.   if (getaProp(getaProp(gObjects, myCousin), #State) <> #off) and (calcC11AttrState() <> #Attr) then
  170.     DelObjects(getaProp(getaProp(ParentOBJ, #SpecialChild), getaProp(ParentOBJ, #State)))
  171.     MakeDynamic(whichChild, #loc, the onloc of OBj)
  172.     MakeDynamic(#barGraphBkgnd, #DisplayState, the State of the barGraphBkgnd of gObjects)
  173.     AddObjects(getaProp(getaProp(ParentOBJ, #SpecialChild), calcC11grafState()))
  174.     erasegraphs()
  175.     return getaProp(getaProp(gObjects, #weatherObj), #Condition)
  176.   end if
  177. end
  178.  
  179. on CancelAccessC11ControlPanel
  180.   switchOFFC11()
  181. end
  182.  
  183. on AccessC11ControlPanel
  184.   set theCurrentState to calcC11AttrState()
  185.   if theCurrentState = #Attr then
  186.     setaProp(getaProp(gStates, #Conditions), #weatherControl, 1)
  187.     doAttrTransition()
  188.   else
  189.     set ParentObjRef to #weatherObj
  190.     set ParentOBJ to getaProp(gObjects, ParentObjRef)
  191.     DelObjects(getaProp(getaProp(ParentOBJ, #SpecialChild), getaProp(ParentOBJ, #State)))
  192.     if not voidp(getaProp(getaProp(gStates, #BeenThere), #d04)) then
  193.       MakeDynamic(#C11AccessControlPanel, #State, #error2)
  194.       MakeDynamic(#C11AccessControlPanel, #DisplayState, #error2)
  195.     else
  196.       MakeDynamic(#C11AccessControlPanel, #State, #error1)
  197.       MakeDynamic(#C11AccessControlPanel, #DisplayState, #error1)
  198.       if getaProp(getaProp(gObjects, #C11AccessControlPanel), #metError1) = 1 then
  199.         PDARelease("J04m08p.mov")
  200.       else
  201.         PDARelease("J04m06p.mov")
  202.         MakeDynamic(#C11AccessControlPanel, #metError1, 1)
  203.       end if
  204.     end if
  205.     AddObjects(getaProp(getaProp(ParentOBJ, #SpecialChild), theCurrentState))
  206.     MakeDynamic(#c02worker, #metCondition6, 1)
  207.   end if
  208.   return getaProp(getaProp(gObjects, #weatherObj), #Condition)
  209. end
  210.  
  211. on doAttrTransition
  212.   set Mobj to getaProp(gObjects, #weatherObj)
  213.   set gHaveNavs to #false
  214.   cursor(getaProp(gCursorlist, #NullCursor))
  215.   set gHotRects to [:]
  216.   addUnvObjects()
  217.   removeAccessState()
  218.   if the transitionsPlayed of the weatherObj of gObjects = 0 then
  219.     MakeDynamic(#weatherObj, #transitionsPlayed, 1)
  220.     AddObjects([#flashQT])
  221.     Startthetimer(60, string("waitForMyQT #flashQT, #transAttrQT"))
  222.   else
  223.     Startthetimer(1, "loadAttrState", #weatherObj)
  224.   end if
  225. end
  226.  
  227. on waitForMyQT OBJref, NextObjRef, loadNow
  228.   repeat while the movieRate of sprite sQTCharSprite
  229.     updateStage()
  230.   end repeat
  231.   set the loc of sprite getaProp(getaProp(gObjects, OBJref), #SpriteNum) to point(20000, 20000)
  232.   DelObjects([OBJref])
  233.   if not voidp(NextObjRef) then
  234.     Startthetimer(1, string("addObjects [#transAttrQT]"))
  235.     Startthetimer(60, "waitForMyQT #transAttrQT, void, 1")
  236.   end if
  237.   if not voidp(loadNow) then
  238.     loadAttrState()
  239.   end if
  240. end
  241.  
  242. on moveflashQT
  243.   set the loc of sprite getaProp(getaProp(gObjects, #flashQT), #SpriteNum) to point(20000, 20000)
  244. end
  245.  
  246. on removeAccessState
  247.   set ParentObjRef to #weatherObj
  248.   set ParentOBJ to getaProp(gObjects, ParentObjRef)
  249.   set OBj to getaProp(gObjects, #C11AccessControlPanel)
  250.   DelObjects(getaProp(getaProp(ParentOBJ, #SpecialChild), #Access))
  251.   MakeDynamic(#weatherObj, #State, #Attr)
  252.   set the loc of the barGraphBkgnd of gObjects to the onloc of the barGraphBkgnd of gObjects
  253. end
  254.  
  255. on loadAttrState
  256.   set gHaveNavs to #true
  257.   AddObjects([#weatherObj])
  258.   PDARelease("J04m09p.mov")
  259. end
  260.